## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%namespace file="/component/navigation.html" import="header_blog" />
<%namespace file="/component/utils.html" import="*" />
<%!
    from pythonblog.service.section_service import all_sections
    from pythonblog.service.content_service import get_post
%>
<div class="span-24 last " id="blog_wrapper" style="margin-top:10px; background: #FFFFFF;">
    <div>
        <div class="span-5">
            <div id="local">
                <div id="blog_owner">
                    <div id="blog_owner_logo">${link_for_user_logo(c.userInfo)}</div>
                    <div id="blog_owner_name">${c.userInfo.author} <br/><a href="${h.url_for(controller='blog', action='profile_view', sub_domain=c.userInfo.userName)}" class="profile">详细资料</a>
                    </div>
                </div>
                <div style="padding-top: 5px;" id="blog_actions">
                    <ul>
                        <li>浏览: ${c.userInfo.viewTimes + c.blogInfo.viewTimes} 次</li>
                        % if c.userInfo.gender:
                        <li>性别: <img title="${c.userInfo.gender == 1 and u'男' or u'女'}" src="${h.url_for('/images/icon_minigender_%s.gif'%c.userInfo.gender)}" /></li>
                        % endif
                        % if c.userInfo.city:
                        <li>来自: ${c.userInfo.city}</li>
                        % endif
                    </ul>
                </div>
                % if h.auth.authorized(h.auth.is_valid_user) and c.userInfo.userName == request.environ['REMOTE_USER'] :
                <div id="blog_admin">
                    <h5>我的专区</h5>
                    <ul>
                        <li><a href="${h.url_for(controller='post', action='new', sub_domain=c.userInfo.userName)}">发表文章</a></li>
                        <li><a href="${h.url_for(controller='post', action='drafts', sub_domain=c.userInfo.userName)}">草稿 (${c.blogInfo.draftNumber})</a></li>
                        <li><a class="profile" href="${h.url_for(controller='blog', action='profile_edit', sub_domain=c.userInfo.userName)}">修改我的资料</a></li>
                    </ul>
                </div>
                % endif
                <div id="blog_menu">
                    <h5>文章分类</h5>
                    <ul>
                        <li>${link_for_user(c.userInfo.userName, u'全部文章 (%s)'%c.blogInfo.postNumber)}</li>
                        % for id in all_sections.keys():
                        % if c.blogInfo.sectionNumbers.has_key(id):
                        <% section = all_sections[id] %>
                        <li><a href="${h.url_for('section', section_path=section.path, sub_domain=c.userInfo.userName)}">${section.name} (${c.blogInfo.sectionNumbers[section.id]})</a></li>
                        % endif
                        % endfor
                    </ul>
                </div>
                <div id="comments_top">
                    <h5>文章排行榜</h5>
                    <ul>
                        % for element in c.blogInfo.topPosts:
                        <% post = get_post(element.id) %>
                        <li><a href="${h.url_for(controller='post', action='view', id=post.id, sub_domain=c.userInfo.userName)}">${post.title}</a></li>
                        % endfor
                    </ul>
                </div>
            </div>
        </div>
        <div class="span-19 last">
            ${next.body()}
        </div>
    </div>
</div>

<%def name="title()">职驿网 -- ${c.userInfo.author}</%def>

<%def name="head()">
${parent.head()}
${h.stylesheet_link(h.url_for('/css/blog.css'))}
${h.stylesheet_link(h.url_for('/css/column.css'))}
</%def>

<%def name="header()">
${header_blog()}
<div id="hotWrapper">
    <div id="hotContainer">
        <div class="space_url">永久个人主页 ${link_for_user(c.userInfo.userName)}</div>
        <div><h2>${link_for_user(c.userInfo.userName, c.userInfo.author)}</h2></div>
    </div>
</div>
</%def>